//
//  FiveStarPopView.m
//  markmap
//
//  Created by 甘世清 on 2024/7/20.
//

#import "FiveStarPopView.h"

@implementation FiveStarPopView

- (void)SQ_UIViewForSelfView{
    self.backgroundColor = UIColor.clearColor;
    self.layer.cornerRadius = 10;
    self.layer.masksToBounds = YES;
    UIImageView * bgImage = [[UIImageView alloc]init];
    bgImage.image = SQGetImage(@"弹窗背景2");
    [self addSubview:bgImage];
    [bgImage mas_makeConstraints:^(MASConstraintMaker *make) {
            make.edges.equalTo(self);
    }];
    UIImageView * starImage = [[UIImageView alloc]init];
    starImage.image = SQGetImage(@"五角星");
    [self addSubview:starImage];
    [starImage mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(self);
        make.width.mas_equalTo(192);
        make.height.mas_equalTo(32);
        make.top.equalTo(self).offset(143);
    }];
    
    UILabel * topLabel = [[UILabel alloc]init];
    topLabel.text = SQNSLocalString(@"免费试用说明");
    topLabel.font = FONT_MEDIUM(17);
    topLabel.textColor = UIColor.blackColor;
    [self addSubview:topLabel];
    [topLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(self);
            make.top.equalTo(self).offset(30);
    }];
    UILabel * messageLabel = [[UILabel alloc]init];
    messageLabel.numberOfLines = 0;
    messageLabel.textAlignment = NSTextAlignmentCenter;
    messageLabel.text = SQNSLocalString(@"点击立即评价，给予5星好评并截图后返回app上传评价截图，通过后立即使用");
    messageLabel.font = FONT_REGULAR(14);
    messageLabel.textColor = SQColor333333;
    [self addSubview:messageLabel];
    [messageLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self);
        make.top.equalTo(self).offset(60);
        make.width.mas_equalTo(230);
    }];
    UIView * lineView = [[UIView alloc]init];
    lineView.backgroundColor = SQColorF5F5F5;
    [self addSubview:lineView];
    [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.equalTo(self);
            make.height.mas_equalTo(1);
            make.bottom.equalTo(self.mas_bottom).offset(-45);
    }];
    SQCustomButton * leftBtn = [[SQCustomButton alloc]initType:SQCustomButtonTopImageType imageSize:CGSizeMake(0, 0) midmargin:0];
    leftBtn.text = SQNSLocalString(@"立即评价");
    leftBtn.textColor = SQColor999999;
    leftBtn.font = FONT_MEDIUM(14);
    [self addSubview:leftBtn];
    [leftBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.bottom.equalTo(self);
            make.width.mas_equalTo(140);
            make.height.mas_equalTo(44);
    }];
    [self addSubview:self.goUploadBtn];
    [self.goUploadBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.bottom.equalTo(self);
            make.width.mas_equalTo(140);
            make.height.mas_equalTo(44);
    }];
    WS(weakSelf);
    [leftBtn setTouchBlock:^(SQCustomButton * _Nonnull button) {
        [weakSelf SQ_leftBtn];
    }];
}
-(void)SQ_leftBtn{
  [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"itms-apps://itunes.apple.com/app/6483865713?action=write-review"]];
   
}

- (SQCustomButton *)goUploadBtn{
    if (!_goUploadBtn) {
        _goUploadBtn = [[SQCustomButton alloc]initType:SQCustomButtonTopImageType imageSize:CGSizeMake(0, 0) midmargin:0];
        _goUploadBtn.backgroundColor = SQColor(@"#BF33FF");
        _goUploadBtn.text = SQNSLocalString(@"上传评价截图");
        _goUploadBtn.font = FONT_MEDIUM(14);
        _goUploadBtn.textColor = UIColor.whiteColor;
    }
    return _goUploadBtn;
}

@end
